﻿//////////////////////////////////////////////////////////////////////////////////////
///// MainMenu.cs                                                      /////
///// 시작시 메인메뉴 화면                                       /////
//////////////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;


namespace Pyramid_Game
{
    class MainMenu : GameScreen
    {
        #region Declarations

        Texture2D menuTexture;

        #endregion

        #region Load
        
        public MainMenu() { }
        public override void LoadContent(ContentManager content)
        {
            menuTexture = content.Load<Texture2D>("Texture/main");
        }

        #endregion

        #region Update & Draw
        
        public override void Update(Touch touch, GameTime gameTime)
        {
            foreach (GestureSample gesture in touch.Gestures)
            {
                if (gesture.GestureType == GestureType.Tap)
                {
                    Point tapLocation = new Point((int)gesture.Position.X, (int)gesture.Position.Y);

                    if (tapLocation.X > 0 &&
                        tapLocation.X < Game1.viewport.Width / 4 &&
                        tapLocation.Y > Game1.viewport.Height * 3 / 4 &&
                        tapLocation.Y < Game1.viewport.Height)
                    {
                        ScreenManager.AddScreen(new Loading());
                        ScreenManager.RemoveScreen(this);
                        GameConstants.IsLoading = true;
                    }
                }
            }
        }
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            Rectangle TitleRect = new Rectangle(Game1.viewport.Width / 4, 0, Game1.viewport.Width * 2 / 4, Game1.viewport.Height / 4);

            spriteBatch.Draw(menuTexture, Vector2.Zero, Color.White);
        }

        #endregion
    }
}
